
#include <string>
#include <assert.h>
#include <websocketpp/logger/basic.hpp>
#include <websocketpp/concurrency/none.hpp>
#include <websocketpp/concurrency/basic.hpp>
#include <sstream>

void test0(){
    typedef websocketpp::log::basic<websocketpp::concurrency::none,websocketpp::log::alevel> access_log;

    std::stringstream out;
    access_log logger(0xffffffff,&out);

    logger.clear_channels(0xffffffff);

    logger.write(websocketpp::log::alevel::devel,"devel");
   // std::cout << "|" << out.str() << "|" << std::endl;
    assert( out.str().size() == 0 );
}
void test1(){
    typedef websocketpp::log::basic<websocketpp::concurrency::none,websocketpp::log::alevel> access_log;

    std::stringstream out;
    access_log logger(0xffffffff,&out);

    logger.set_channels(0xffffffff);

    logger.write(websocketpp::log::alevel::devel,"devel");
   // std::cout << "|" << out.str() << "|" << std::endl;
    assert( out.str().size() > 0 );
}

void test_copy_constructor1 (){
    typedef websocketpp::log::basic<websocketpp::concurrency::basic,websocketpp::log::alevel> basic_access_log_type;

    std::stringstream out;
    basic_access_log_type logger1(0xffffffff,&out);
    basic_access_log_type logger2(logger1);
    //basic_access_log_type logger2(std::move(logger1));  // move_constructor

    logger2.set_channels(0xffffffff);
    logger2.write(websocketpp::log::alevel::devel,"devel");
    assert( out.str().size() > 0 );
}
void test_copy_constructor2 (){
    typedef websocketpp::log::basic<websocketpp::concurrency::basic,websocketpp::log::alevel> basic_access_log_type;

    std::stringstream out;
    basic_access_log_type logger1(0xffffffff,&out);
    basic_access_log_type logger2(logger1);

    logger2.set_channels(0xffffffff);
    logger1.write(websocketpp::log::alevel::devel,"devel");
    assert( out.str().size() == 0 );
}


int main(){
    test0();
    test1();
    test_copy_constructor1();
    test_copy_constructor2();
}


